Imports CapaDeDatos.dBanco
Public Class nBanco
    Public Banco As CapaDeDatos.dBanco = New CapaDeDatos.dBanco
    Public Imputacion As CapaDeDatos.dImputacion = New CapaDeDatos.dImputacion
    Public Function InsertarBanco(ByVal Denominacion As String, ByVal CodigoImputacion As String) As Boolean
        Return Banco.Insertar(Denominacion, CodigoImputacion)
    End Function
    Public Function EliminarBanco(ByVal CodigoBanco As Integer) As Boolean
        Return Banco.Eliminar(CodigoBanco)
    End Function
    Public Function ModificarBanco(ByVal CodigoBanco As Integer, ByVal Denominacion As String, ByVal CodigoImputacion As String) As Boolean
        Return Banco.Modificar(CodigoBanco, Denominacion, CodigoImputacion)
    End Function
    Public Function ExisteBanco(ByVal Denominacion As String) As Boolean
        Return Banco.Existe(Denominacion)
    End Function
    Public Function ListarBanco(ByVal CodigoBanco As Integer, ByVal Denominacion As String, ByVal CodigoImputacion As String) As DataSet
        Return Banco.BuscarFiltrado(CodigoBanco, Denominacion, CodigoImputacion)
    End Function
    Public Function ListarTodos(ByVal CodigoBanco As Integer, ByVal Denominacion As String, ByVal CodigoImputacion As String) As DataSet
        Dim dtsPrincipal As DataSet
        dtsPrincipal = Banco.BuscarFiltrado(CodigoBanco, Denominacion, CodigoImputacion)
        dtsPrincipal.Tables(0).Columns.Add("Descripcion")
        Dim i As Integer
        For i = 0 To dtsPrincipal.Tables(0).Rows.Count - 1
            Try
                dtsPrincipal.Tables(0).Rows(i)("Descripcion") = Imputacion.BuscarFiltrado(dtsPrincipal.Tables(0).Rows(i)("CodigoImputacion").ToString(), "", "").Tables(0).Rows(0)("Descripcionimp").ToString()
            Catch ex As Exception
                dtsPrincipal.Tables(0).Rows(i)("Descripcion") = "Error,Imputacion Nombre no Encontrada"
            End Try
        Next
        Return dtsPrincipal
    End Function

End Class
